#define _CRT_SECURE_NO_WARNINGS 1

void my_Swap(int* x, int* y)
{
    int tmp = *x;
    *x = *y;
    *y = tmp;
}

void rotate(int** matrix, int matrixSize, int* matrixColSize) {
    int n = matrixSize;
    int mid = 0;
    while (n - mid * 2 > 1)
    {
        for (int i = mid; i < n - mid - 1; i++)
        {// 1.[mid][i] 2.[i][n-mid-1] 3.[n-mid-1][n-i-1] 4.[n-i-1][mid]
            my_Swap(&matrix[mid][i], &matrix[n - i - 1][mid]);
            my_Swap(&matrix[n - i - 1][mid], &matrix[n - mid - 1][n - i - 1]);
            my_Swap(&matrix[n - mid - 1][n - i - 1], &matrix[i][n - mid - 1]);
        }
        mid++;
    }
}